跳到主要内容

vcpkg 包管理

https://learn.microsoft.com/zh-cn/vcpkg/get_started/get-started?pivots=shell-cmd

配置代理

setx https_proxy http://127.0.0.1:10809/
setx http_proxy http://127.0.0.1:10809/

# SET 用于设置临时环境变量(批处理脚本中经常用到).
# SETX 则用于设置用户环境变量和系统环境变量

# 查看环境变量
echo %http_proxy%

# 删除环境变量
setx http_proxy ""
setx https_proxy ""

检查是否安装

vcpkg version

# 安装
vcpkg install curl

# 查看安装的包
vcpkg list

配置环境

当你在vcpkg中运行vcpkg integrate install命令后,vcpkg会尝试自动处理Visual Studio的库和包含目录设置。这个命令会生成一些注册表项,使得任何使用MSBuild的项目都能自动识别vcpkg安装的库。这种方式通常避免了在每个项目中手动设置库和包含目录的需求。

vcpkg integrate install

配置仓库

https://learn.microsoft.com/en-us/vcpkg/reference/vcpkg-configuration-json

{
"default-registry": {
"kind": "git",
"repository": "https://internal/mirror/of/github.com/Microsoft/vcpkg",
"baseline": "eefee7408133f3a0fef711ef9c6a3677b7e06fd7"
},
"registries": [
{
"kind": "artifact",
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
"name": "microsoft"
}
]
}